#include <iostream>
#include <math.h>
using namespace std;

inline bool isPrime(int p)
{
    if (p==1)
        return false;
    else if (p==2)
        return true;
    int res=pow(p,0.5);
    for (int i=2;i<res+1;i++)
    {
        if (p%i==0)
        { 
            return false;
        }
    }
    return true;
}

int main()
{
    int n;
    cin>>n;
    for (int i=0;i<n;i++)
    {
        int p;
        cin>>p;
        if (isPrime(p))
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
}